#include "matrix.h"

void matrix::input_mat()
  {
    for(int i=0; i <m ; i++)
    {
      for (int j=0; j<n; j++)
      {
        //cout<<"Enter Element"<<i+1<<" , "<<j+1<<"?";
        value[i][j]= j;
      }
    }

  }

  void matrix::addition(matrix m1, matrix m2){
    if(m1.m== m2.m && m1.n==m2.n)
    {
      for(int i=0; i <m ; i++)
      {
        for (int j=0; j<n; j++)
        {
          value[i][j]+=m1.value[i][j] + m2.value[i][j];
        }
      }
      
    }
    else 
    {
      cout<<"Matrix Additionis not possible ";
    }
  }
  void matrix::display()
  {
    cout<<"Matrix Results are:"<<endl;
    for(int i=0; i <m ; i++)
    {
      for (int j=0; j<n; j++)
      {
        cout<<value[i][j]<<" " <<endl;
      }
    }
  }


  void matrix::multiply_mat(matrix m1, matrix m2)
  {
    if(m1.n!=m2.m)
      cout<<"Matrix Multiplication is not possible ";
      else
      {
      for(int i=0;i<m1.m;i++)
      for(int j=0;j<m1.n;j++)
      for(int k=0;k<m2.n;k++)
      {
        value[i][j]+=m1.value[i][k]*m2.value[k][j];      
      }
    }
}


